package io.writeFile;

import java.io.*;

/**
 * 读取文件中的数据到另外的文件
 * 方法2：按每个字符读取，效率低
 */
public class ReadFileToOther2 {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("./other/src/io/writeFile/old.txt");

        FileOutputStream fos = new FileOutputStream("./other/src/io/writeFile/new.txt", false);
        int c=0;
        while ((c=fis.read())!=-1){
            System.out.println(c);
            fos.write(c);
        }

        fos.close();
        fis.close();
    }
}
